﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;


namespace Sige
{
    class alumnosporcomision
    {
    
        string matricula;
        string tipodocumento;
        string documento;
        string codigocomision;
        bool estado;


        public string m_matricula
        {
            get { return matricula; }

            set { matricula = value; }
        }


        public string m_tipodocumento
        {
            get { return tipodocumento; }

            set { tipodocumento = value; }
        }


        public string m_documento
        {
            get { return documento; }

            set { documento = value; }
        }


        public string m_codigocomision
        {
            get { return codigocomision; }

            set { codigocomision = value; }
        }

        public bool m_estado
        {
            get { return estado; }

            set { estado = value; }
        }
      
        public bool grabar(ref Persona objpersona,ref comisiones objcomision,string nromatricula,ref SqlConnection cn_superbit)
        {
            if (cn_superbit.State == ConnectionState.Closed)
                cn_superbit.Open();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "INSERT alumnosporcomision (matricula,tipodocumento,documento,codigocomision,estado) VALUES (@matricula,@tipodoc ,@doc ,@comision ,1)";
            cmd.Connection = cn_superbit; 
            cmd.Parameters.AddWithValue("@matricula",nromatricula.ToString() );
            cmd.Parameters.AddWithValue("@tipodoc", objpersona.TipoDocumento.ToString());
            cmd.Parameters.AddWithValue("@doc", objpersona.Documento.ToString());
            cmd.Parameters.AddWithValue("@comision",objcomision.m_comision.ToString());
            try
            {
                cmd.ExecuteNonQuery();
            }
            catch
            {
                cn_superbit.Close();
                return false;
            }
            cn_superbit.Close();
            return true;
        }
       
    
    }
}
